//
//  QPointsTypeCell.m
//  QoilPublic
//
//  Created by 杨凯 on 2017/3/19.
//  Copyright © 2017年 杨凯. All rights reserved.
//

#import "QPointsTypeCell.h"
@interface QPointsTypeCell ()
@property (weak, nonatomic) IBOutlet UILabel *timeLab;
@property (weak, nonatomic) IBOutlet UIImageView *stateImg;
@property (weak, nonatomic) IBOutlet UILabel *pointLab;
@property (weak, nonatomic) IBOutlet UILabel *typeLab;

@end
@implementation QPointsTypeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)setModel:(QPointDetailModel *)model{
    _model = model;
    if ([[_model.curr_date substringWithRange:NSMakeRange(0, 10)] isEqualToString:[_model.create_time substringWithRange:NSMakeRange(0, 10)]]) {
        _dateLab.text = @"今天";
        
    }else{
        _dateLab.text = [[[_model.create_time componentsSeparatedByString:@" "] firstObject] substringWithRange:NSMakeRange(5, 5)];
    }
    
    _timeLab.text = [[[_model.create_time componentsSeparatedByString:@" "] lastObject] substringWithRange:NSMakeRange(0, 5)];
    if ([_model.yangkai isEqualToString:@"2"]) {
        _pointLab.text = [NSString stringWithFormat:@"+%@",_model.integration];
        if ([_model.type isEqualToString:@"0"]) {
            _stateImg.image = [UIImage imageNamed:@"point_sign"];
        }else if ([_model.type isEqualToString:@"1"]){
            _stateImg.image = [UIImage imageNamed:@"point_share"];
        }else if ([_model.type isEqualToString:@"2"]){
            _stateImg.image = [UIImage imageNamed:@"point_evaluate"];
        }else if ([_model.type isEqualToString:@"3"]){
            _stateImg.image = [UIImage imageNamed:@"point_marketGet"];
        }else if ([_model.type isEqualToString:@"4"]){
            _stateImg.image = [UIImage imageNamed:@"point_oder"];
        }else if ([_model.type isEqualToString:@"6" ]){
            _stateImg.image = [UIImage imageNamed:@"point_server"];
        }
    }else{
        _pointLab.text = [NSString stringWithFormat:@"%@",_model.integration];
        if ([_model.type isEqualToString:@"0"]) {
            _stateImg.image = [UIImage imageNamed:@"point_marketCut"];
        }else if ([_model.type isEqualToString:@"1"]){
            _stateImg.image = [UIImage imageNamed:@"point_server"];
        }else if ([_model.type isEqualToString:@"2"]){
            _stateImg.image = [UIImage imageNamed:@"point_cancelOder"];
        }else if ([_model.type isEqualToString:@"6" ]){
            _stateImg.image = [UIImage imageNamed:@"point_server"];
        }

    }
    _typeLab.text = _model.type_name;
    
    
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
